<template>
  <a-drawer class="class_radio" title="自定义选择列" :width="244" :z-index="10" :visible="visible"
    :body-style="{ padding: '20px 20px 80px 20px' }" @close="onClose">
    <a-radio   v-for="(item, index) in list" :key="item.key" :checked="item.checked"
      @click="radioChange(index, item)">
      {{ item.title }}
    </a-radio>
  </a-drawer>
</template>
<script>
export default {
  name: 'ChangeTable',

  props: {
    columns: {
      type: Array,
      required: false,
      default: () => []
    }

  },
  data () {
    return {
      visible: false,
      list: []
    }
  },
  methods: {
    onClose () {
      this.$emit('columnsChange', this.list)
      this.visible = false
    },
    radioChange (index, item) {
      this.list[index].checked = !item.checked
    },

    onInitial (data) {
      this.list = JSON.parse(JSON.stringify(this.columns))
      this.visible = true
    }
  }
}
</script>
<style scoped>
</style>
